<!--
 * @Description:
 * @Author: cgt
 * @Date: 2021-12-23 14:05:56
 * @LastEditors: cgt
 * @LastEditTime: 2021-12-28 19:56:10
-->
<template>
  <div>
    <el-button @click="show">显示</el-button>
    <el-button @click="hide">隐藏</el-button>
    <el-button @click="changeStyle">切换显示方案</el-button>
  </div>
</template>

<script>
import mixins from '../mixins';
export default {
  name: 'CableGridTool',
  props: {
    getTool: {
      type: Function,
      required: true
    },
    mapLoadSuccess: Boolean
  },
  mixins: [mixins],
  data() {
    return {
      styleChanged: false
    };
  },
  watch: {
    mapLoadSuccess(success) {
      if (success) {
        this.setOption();
      }
    }
  },
  methods: {
    show() {
      this.getTool('CableGridTool').show();
    },
    hide() {
      this.getTool('CableGridTool').hide();
    },
    changeStyle() {
      this.styleChanged = !this.styleChanged;
      let style = this.styleChanged ? 6 : 5;
      this.getTool('CableGridTool').changeStyle(style);
    },
    setOption() {
      this.getTool('CableGridTool').setSearchOption(this.option);
    }
  },
  mounted() {}
};
</script>

<style scoped></style>
